home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Game
/
R
/
ROBOT WARRIORS 1.0.1.CPT
/
Robot Warriors
/
Example Robots
/
Seeker
< prev
next >
Wrap
Text File
|
1991-08-26
|
3KB
|
112 lines
; Robot Name: Seeker
;
; Seeks out and destroys other robots. Cloak if damaged or if a close robot
; is detected. Tries to conserve fuel by not cloaking as much when nearly
; out of fuel.
CPU_SPEED 1
ARMOR 0
FIRE_RATE 2
ENGINE_SIZE 0
RADAR_RANGE 0
CLOAKING 1
FUEL_CAPACITY 2
allocate oldaim
allocate old_damage
seeker_interrupt to time_int_xfer
1 to time_int_mask
aim - 4 to aim
;Start off towards the center of the arena
if x < 180 then
if y < 150 then
135 to direction ;in upper left, move towards lower right
else
45 to direction ;in lower left, move towards upper right
end
else
if y < 150 then
225 to direction ;in upper right, move towards lower left
else
315 to direction ;in lower right, moved towards upper left
end
end
20 to speed
again
repeat
if speed = 0 then
gosub cloak_me
120 + direction to direction ;Move away to possible collision source
20 to speed
end
if X < 20 then 90 to direction
if Y < 20 then 180 to direction
if X > 360 then 270 to direction
if Y > 290 then 0 to direction
if damage <> old_damage then gosub cloak_me
aim + 3 to aim
aim to radar
until radar > 0
if shot > 0 then
aim - 9 to aim
else
aim to oldaim
300/radar + aim - 1 to aim ;Try to hit the center of the enemy robot
;Usually enemy robots are moving away, shoot ahead of them
radar / 10 + radar to shot
aim to direction
if radar < 80 then gosub cloak_me
;Try to avoid hitting the other robot
if radar < 110 then aim - 10 to direction
if radar < 85 then aim - 30 to direction
if radar < 45 then
aim - 120 to direction
else
if radar < 85 then aim - 40 to direction
end
oldaim to aim
aim - 4 to aim
end
goto again
;Try to hide while conserving fuel
cloak_me
damage to old_damage
if damage > 75 then ;about to die
fuel/50 to cloak
if damage > 90 then cloak + 10 to cloak ;really about to die
else
if fuel < 150 then ;almost out of fuel don't cloak to much
2 to cloak ;Only cloak enough to possibly trick other robot.
if damage > 95 then 5 to cloak ;Also about to die, oh no!
else
if fuel > 1500 then ;Lots of fuel, clock for awhile
12 to cloak
else
if fuel > 750 then ;Not as much fuel, don't cloak as long
10 to cloak
else
5 to cloak ;Not much fuel
end
end
end
end
return
seeker_interrupt
if cloak > 0 then cloak - 1 to cloak
endint